package com.ttg.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

import java.util.HashMap;
import java.util.Map;

/**
 * 会员状态 (0正常，1冻结，2删除）
 *
 * @author CZW
 * @date 2021/07/02 14:50
 **/
public enum CouponVipStatusEnum {


    /**
     * 正常
     */
    NORMAL(0, "正常"),
    /**
     * 冻结
     */
    FROZEN(1, "冻结"),
    /**
     * 删除
     */
    DELETE(2, "删除");

    @EnumValue
    @JsonValue
    private Integer value;
    private String desc;

    CouponVipStatusEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public Integer getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    private static final Map<Integer, CouponVipStatusEnum> VALUES = new HashMap<>();

    static {
        for (final CouponVipStatusEnum type : CouponVipStatusEnum.values()) {
            CouponVipStatusEnum.VALUES.put(type.getValue(), type);
        }
    }

    @JsonCreator
    public static CouponVipStatusEnum of(Integer code) {
        return CouponVipStatusEnum.VALUES.get(code);
    }
}
